#!/usr/bin/env python
# -*- coding: utf-8 -*-
from common.yaml_config import config
from config.chrome_driver_config import ChromeDriverConfig
from config.edge_driver_config import EdgeDriverConfig
from config.firfor_driver_config import FirforDriverConfig


class DriverConfig:
    def driver_config(self, root_path='./'):
        browser = config.get_browser()
        print("加载浏览器：" + browser)
        driver = None
        if browser.lower() == 'firefox':
            driver = FirforDriverConfig().driver_config(root_path)
        elif browser.lower() == 'chrome':
            driver = ChromeDriverConfig().driver_config(root_path)
        elif browser.lower() == 'edge':
            driver = EdgeDriverConfig().driver_config(root_path)
        else:
            raise ValueError(f"浏览器{browser}配置错误")
        return driver
